#include<bits/stdc++.h>
using namespace std;
int main()
{
	int cnt = 0;
	for(int i = 11;i <= 33;i++)
	{
		int x = i*i;
		if(x%10 == x/10%10 || x%10 == x/100 || x/10%10 == x/100)
			cnt++;
	}
	cout<<cnt;
    return 0;
}

